package weixin.idea.extend.function.impl;

import javax.servlet.http.HttpServletRequest;

import weixin.guanjia.core.entity.message.resp.TextMessageResp;
import weixin.guanjia.core.util.MessageUtil;
import weixin.idea.extend.function.KeyServiceI;

/**
 * 关键字：激活码 功能类：weixin.idea.key.function.impl.ActivationCodeService
 * 描述：实现用户回复自动发放激活码，每人用户每个游戏只能领取一次
 * 
 * @author renlr
 */
public class ActivationCodeService implements KeyServiceI {

	@Override
	public String getKey() {
		return "激活码";
	}

	@Override
	public String excute(String content, TextMessageResp textMessage, HttpServletRequest request) {
		String activCode = content.trim();
		String returnMessage = null;
		if ("".equals(activCode)) {
			returnMessage = getTranslateUsage();
		} else {
			returnMessage = "目前正在开发中......" + textMessage;
		}
		textMessage.setContent(returnMessage);
		return MessageUtil.textMessageToXml(textMessage);
	}

	/**
	 * 使用指南
	 * 
	 * @return
	 */
	public static String getTranslateUsage() {
		StringBuffer buffer = new StringBuffer();
		buffer.append("回复游戏名称获取激活码,每个用户单个游戏只能获取一次").append("\n\n");
		return buffer.toString();
	}

}
